$(function() {
	
	// 物流公司下拉框
	sys.selectpicker({
        id : 'deliveryCompanyCode',
        url : rootPath + "/dict/listKeyMapEntites", // 请求数据的远程地址
        param : {
            keyType : 'deliveryCompany'
        },
        valueField : 'keyValue',
        textField : 'keyIntro'
    });
	
	// 部分发货操作
	$("#btn_ok").click(function() {
		var url = rootPath + "/orderDeliveredBill/sendPartOrder";
		var params = {
			ids : $("#ids").val(),
			sendNum: $("#sendNum").val(),
			orderCode : $("#orderCode").val(),
			detailIds : $("#detailIds").val(),
			deliveryCompanyCode : $("#deliveryCompanyCode").val(),
			deliveryCode : $("#deliveryCode").val(),
			intro: $("#intro").val()
		};
		$.ajax({
	        type:"post",
	        url:url,
	        data:params,
	        datatype: "json",
	        success:function(json){
	        	if(json.resultCode == '1'){
	        		var index = parent.layer.getFrameIndex(window.name);
	        		parent.layer.alert('发货成功',{icon: 6});
	        		parent.layer.close(index);
	        		parent.location.href = rootPath + "/order/toOrderDetail?orderCode="+$("#orderCode").val()+"&tabIndex=4";
	        	}
	        },
	        error: function(){
	        	showErr("发货失败");
	        }
		});
	});
	
	
	$("#btn_back").click(function() {
		var index = parent.layer.getFrameIndex(window.name);
		parent.layer.close(index);
	});
	
});

